<?php
include("../db_connect.php");
$data = array();

if(isset($_GET['approve'])){
	
	if($_GET['approve'] == "approve"){
		approve();
	}
	else{
		disapprove();
	}
	
}


function approve(){
	$userid = $_GET['userid'];
	$data = explode("," , $userid);
	$x =1;
	for($i=0; $i<=sizeof($data)-1; $i++ ){
		
			$sql = "UPDATE tbl_account SET isaprove='".$x."' where id= ".$data[$i]." "; 
			mysql_query($sql);
	}

	if(mysql_affected_rows() ){
		echo " 1 ";
	}
	else{
		echo $sql;
	}
}

function disapprove(){
	$userid = $_GET['userid'];
	$data = explode("," , $userid);
	$x = 3;
	for($i=0; $i<=sizeof($data)-1; $i++ ){
		
			$sql = "UPDATE tbl_account SET isaprove='".$x."' where id= ".$data[$i]." "; 
			mysql_query($sql);
	}

	if(mysql_affected_rows() ){
		echo " 1 ";
	}
	else{
		echo $sql;
	}
}

?>